package com.jblv.frame.common.params;

import java.io.Serializable;
import java.util.LinkedHashMap;

/**
 * @author happyonion.yangtao
 * @version 1.0
 * @title PageParams
 * @projectName jblv-frame
 * @packageName com.jblv.common.params
 * @description 公共分页参数
 * @date Create at 2020/4/29 23:16
 * @since jdk1.8
 */
public class PageParams implements Serializable {

    private static final long serialVersionUID = 4062979081149120699L;

    private int page = 1;
    private int limit = 30;
    private LinkedHashMap<String, Boolean> sortMap = new LinkedHashMap();
    private LinkedHashMap<String, Object> filterMap = new LinkedHashMap();

    public PageParams() {
    }

    public LinkedHashMap<String, Boolean> getSortMap() {
        return this.sortMap;
    }

    public LinkedHashMap<String, Object> getFilterMap() {
        return this.filterMap;
    }

    public void setSortMap(LinkedHashMap<String, Boolean> sortMap) {
        this.sortMap = sortMap;
    }

    public void setFilterMap(LinkedHashMap<String, Object> filterMap) {
        this.filterMap = filterMap;
    }

    public Object getFilterValue(String key) {
        return this.filterMap.get(key);
    }

    public void addFilter(String key, Object value) {
        this.filterMap.put(key, value);
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public Boolean getSortVale(String key) {
        return (Boolean)this.sortMap.get(key);
    }

    public void addSort(String key, Boolean value) {
        this.sortMap.put(key, value);
    }
}
